package com.laguille.games.tetris.model.Tetromino;

public class Coordinates {
	private int x; // 
	private int y;
	
	public Coordinates(int x, int y)
	{
		this.x = x;
		this.y = y;
	}

	public int getX() {
		return x;
	}

	public int getY() {
		return y;
	}

	/**
	 * shifts coordinates to the left
	 * @return a copy of the coordinates object shifted on the left
	 */
	public Coordinates shiftLeft()
	{
		return new Coordinates(x - 1, y);
	}
	
	/**
	 * shifts coordinates to the right
	 * @return a copy of the coordinates object shifted on the right
	 */
	public Coordinates shiftRight()
	{
		return new Coordinates(x + 1, y);
	}
	
	/**
	 * shifts coordinates up
	 * @return a copy of the coordinates object shifted up
	 */
	public Coordinates shiftUp()
	{
		return new Coordinates(x, y + 1);
	}
	
	/**
	 * shifts coordinates down
	 * @return a copy of the coordinates object shifted down
	 */
	public Coordinates shiftDown()
	{
		return new Coordinates(x, y - 1);
	}

	@Override
	public boolean equals(Object obj) {
		Coordinates c = (Coordinates)obj;
		return c.x == x && c.y == y;
	}
}
